<?php

defined('BASEPATH') or die('forbidden');

class Ks_Controller extends Controller {

    function _init() {
        $methods = get_class_methods($this);
        foreach ($methods as $m => $n) {
            if (substr($n, 0, 1) == '_' || $n == 'index')
                continue;
            $url = site_url("ks/{$n}/");
            echo "<form action='{$url}' method='post'><a href='{$url}' target='_blank'>{$url}</a><input type='text' /><input type='submit' value='查看' class='sub'/></form>";
        }
        echo "<style type='text/css'>html,body,*{font-size:12px;}</style><script type='text/javascript' src='/res/js/jquery.1.4.4.min.js'></script><script type='text/javascript' src='/res/js/highcharts.js?ver=416'></script>
        <script type='text/javascript' src='/res/js/exporting.js?ver=416'></script>
<script type='text/javascript'>$(function(){\$('.sub').click(function(){\$(this).closest('form').attr('action', \$(this).closest('form').attr('action') + \$(this).prev().val());})});</script><hr />";
    }

    function a() {
        //判断时分秒是否到达,如果时间在一天中的最后15分钟内则向前提15分钟
        $originalseconds = get_day_after_seconds(strtotime("2013-05-17 15:00:58"));
        if (86400 - $originalseconds < 900)
            $originalseconds -= 900;
        $currentseconds = get_day_after_seconds();
        //判断时间是否已到
        echo $currentseconds;
        echo "<br />";
        echo $originalseconds;
    }

    /**
     * index function.
     * Very basic example: juste draw some data
     */
    function defaultchart() {
        print_r(array_merge(array(1, 2, 4), array(5, 6)));
        print_r(array_merge_multi(array('a' => 33, 'c' => array(1)), array('a' => 1, 'b' => 22, 'c' => array(2, 3))));
        // simple highcharts example
        $this->load->library('highcharts');
        $this->highcharts->initialize('default');
        // some data series
        $this->highcharts->push_chart(array('type' => 'line'));

        $this->highcharts->set_serie(array('name' => 'hello', 'data' => array(202, 445, 60, 22, 6, 36)));
        $this->highcharts->set_serie(array('name' => 'hello1', 'data' => array(210, 45, 60, 22, 6, 316)));
        $this->highcharts->set_serie(array('name' => 'hello3', 'data' => array(20, 45, 60, 22, 632, 36)));
        $this->highcharts->set_serie(array('name' => 'hello36', 'data' => array(20, 455, 60, 22, 632, 36)));
        $this->highcharts->set_serie(array('name' => 'hello35', 'data' => array(20, 415, 60, 212, 632, 36)));
        $this->highcharts->set_serie(array('name' => 'hello34', 'data' => array(20, 445, 60, 222, 632, 36)));
        $this->highcharts->set_serie(array('name' => 'hello33', 'data' => array(20, 45, 640, 22, 632, 36)));
        $this->highcharts->set_serie(array('name' => 'hello32', 'data' => array(20, 245, 630, 22, 632, 36)));
        $this->highcharts->set_serie(array('name' => 'hello31', 'data' => array(20, 415, 60, 212, 632, 36)));
        $this->highcharts->set_serie(array('name' => 'he12121llo', 'data' => array(210, 425, 630, 242, 61, 316)));
        $data['charts'] = $this->highcharts->render();
        $this->view->display('charts', $data);
    }

}